import java.util.*;
public class Solution {
    public static int solve (String nums) {
        // write code here
        if (nums.equals("0")) {
            return 0;
        }
        if (nums.equals("10") ||nums.equals("20"))
            return 1;
        int[] dp = new int[nums.length()+1];
         Arrays.fill(dp, 1); 
         for(int i = 2; i <= nums.length(); i++){
            //在11-19，21-26之间的情况
            if((nums.charAt(i - 2) == '1' 
            && nums.charAt(i - 1) != '0') 
            || (nums.charAt(i - 2) == '2' 
            && nums.charAt(i - 1) > '0' 
            && nums.charAt(i - 1) < '7'))
               dp[i] = dp[i - 1] + dp[i - 2];
            else if(nums.charAt(i-1)=='0'&&(nums.charAt(i-2)=='0'||nums.charAt(i-2)>'2')){
                return 0;   }
           else {
                dp[i] = dp[i - 1];
            }   
               
        }
        return dp[dp.length-1];
    }

    public static void main(String[] args) {
        System.out.println(solve("212"));
    }
}